package com.jhws.util;

import java.util.HashMap;

/**
 * 功能： 作者：yangtao 创建时间：2016/7/6 13:42
 */
public class AuthMangager {
	private static AuthMangager instance;
	private HashMap<String, String> tokenMap;

	public static AuthMangager instance() {
		if (instance == null) {
			instance = new AuthMangager();
		}
		return instance;
	}

	public AuthMangager() {
		tokenMap = new HashMap<String,String>();
	}

	public void addToken(String acc, String token) {
		tokenMap.put(acc, token);
	}

	public String getToken(String acc){
		return tokenMap.get(acc);
	}
	
	public boolean isToken(String token){
		return tokenMap.containsValue(token);
	}
	
	public void cleaAll() {
		if (tokenMap.size() > 0) {
			tokenMap.clear();
		}
	}
}
